+2005-11-22 Michael Natterer <mitch@imendio.com>
+
+ Made button-press timeouts which work like key repeat timeouts
+ configurable. Addresses bug #142582:
+
+ * gtk/gtksettings.c: added properties "gtk-timeout-initial" and
+ "gtk-timeout-repeat" which defalt to 200/20 (ms).
+
+ Use the values from GtkSettings instead of hardcoding them
+ (the repeat value is either taken as-is for fast repeat or
+ multiplied by 5 for slow repeat). Changed all places to use these
+ two standard initial/repeat timings:
+
+ * gtk/gtkcalendar.c (unchanged 200/20)
+ * gtk/gtknotebook.c (unchanged 200/100)
+ * gtk/gtkpathbar.c (changed from 300/150 to 200/100)
+ * gtk/gtkrange.c (changed from 250/100 to 200/100)
+ * gtk/gtkspinbutton.c (unchanged 200/20)
+
2005-11-21 Anders Carlsson <andersca@imendio.com>
* configure.in:
+2005-11-22 Michael Natterer <mitch@imendio.com>
+
+ Made button-press timeouts which work like key repeat timeouts
+ configurable. Addresses bug #142582:
+
+ * gtk/gtksettings.c: added properties "gtk-timeout-initial" and
+ "gtk-timeout-repeat" which defalt to 200/20 (ms).
+
+ Use the values from GtkSettings instead of hardcoding them
+ (the repeat value is either taken as-is for fast repeat or
+ multiplied by 5 for slow repeat). Changed all places to use these
+ two standard initial/repeat timings:
+
+ * gtk/gtkcalendar.c (unchanged 200/20)
+ * gtk/gtknotebook.c (unchanged 200/100)
+ * gtk/gtkpathbar.c (changed from 300/150 to 200/100)
+ * gtk/gtkrange.c (changed from 250/100 to 200/100)
+ * gtk/gtkspinbutton.c (unchanged 200/20)
+
2005-11-21 Anders Carlsson <andersca@imendio.com>
* configure.in:
* Mouse handling *
****************************************/
-#define CALENDAR_INITIAL_TIMER_DELAY 200
-#define CALENDAR_TIMER_DELAY 20
-
static void
calendar_arrow_action (GtkCalendar *calendar,
guint arrow)
if (priv->need_timer)
{
+ GtkSettings *settings;
+ guint timeout;
+
+ settings = gtk_widget_get_settings (GTK_WIDGET (calendar));
+ g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
+
priv->need_timer = FALSE;
- priv->timer = g_timeout_add (CALENDAR_TIMER_DELAY,
- (GSourceFunc) calendar_timer,
- (gpointer) calendar);
+ priv->timer = g_timeout_add (timeout,
+ (GSourceFunc) calendar_timer,
+ (gpointer) calendar);
}
else
retval = TRUE;
if (!priv->timer)
{
+ GtkSettings *settings;
+ guint timeout;
+
+ settings = gtk_widget_get_settings (GTK_WIDGET (calendar));
+ g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
+
priv->need_timer = TRUE;
- priv->timer = g_timeout_add (CALENDAR_INITIAL_TIMER_DELAY,
+ priv->timer = g_timeout_add (timeout,
calendar_timer,
calendar);
}
#include "gtkalias.h"
-#define TAB_OVERLAP 2
-#define TAB_CURVATURE 1
-#define ARROW_SIZE 12
-#define ARROW_SPACING 0
-#define NOTEBOOK_INIT_SCROLL_DELAY (200)
-#define NOTEBOOK_SCROLL_DELAY (100)
+#define TAB_OVERLAP 2
+#define TAB_CURVATURE 1
+#define ARROW_SIZE 12
+#define ARROW_SPACING 0
+#define SCROLL_DELAY_FACTOR 5
enum {
if (!notebook->timer)
{
- notebook->timer = g_timeout_add (NOTEBOOK_INIT_SCROLL_DELAY,
- (GSourceFunc) gtk_notebook_timer,
+ GtkSettings *settings = gtk_widget_get_settings (widget);
+ guint timeout;
+
+ g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
+
+ notebook->timer = g_timeout_add (timeout,
+ (GSourceFunc) gtk_notebook_timer,
(gpointer) notebook);
notebook->need_timer = TRUE;
}
{
gtk_notebook_do_arrow (notebook, notebook->click_child);
- if (notebook->need_timer)
+ if (notebook->need_timer)
{
+ GtkSettings *settings;
+ guint timeout;
+
+ settings = gtk_widget_get_settings (GTK_WIDGET (notebook));
+ g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
+
notebook->need_timer = FALSE;
- notebook->timer = g_timeout_add (NOTEBOOK_SCROLL_DELAY,
- (GSourceFunc) gtk_notebook_timer,
+ notebook->timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
+ (GSourceFunc) gtk_notebook_timer,
(gpointer) notebook);
}
else
#define BUTTON_DATA(x) ((ButtonData *)(x))
-#define SCROLL_TIMEOUT 150
-#define INITIAL_SCROLL_TIMEOUT 300
+#define SCROLL_DELAY_FACTOR 5
static guint path_bar_signals [LAST_SIGNAL] = { 0 };
if (path_bar->need_timer)
{
+ GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (path_bar));
+ guint timeout;
+
+ g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
+
path_bar->need_timer = FALSE;
- path_bar->timer = g_timeout_add (SCROLL_TIMEOUT,
+ path_bar->timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
(GSourceFunc)gtk_path_bar_scroll_timeout,
path_bar);
-
}
else
retval = TRUE;
-
}
GDK_THREADS_LEAVE ();
if (!path_bar->timer)
{
+ GtkSettings *settings = gtk_widget_get_settings (widget);
+ guint timeout;
+
+ g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
+
path_bar->need_timer = TRUE;
- path_bar->timer = g_timeout_add (INITIAL_SCROLL_TIMEOUT,
+ path_bar->timer = g_timeout_add (timeout,
(GSourceFunc)gtk_path_bar_scroll_timeout,
path_bar);
}
#include "gtkprivate.h"
#include "gtkalias.h"
-#define SCROLL_INITIAL_DELAY 250 /* must hold button this long before ... */
-#define SCROLL_LATER_DELAY 100 /* ... it starts repeating at this rate */
-#define UPDATE_DELAY 300 /* Delay for queued update */
+#define SCROLL_DELAY_FACTOR 5 /* Scroll repeat multiplier */
+#define UPDATE_DELAY 300 /* Delay for queued update */
enum {
PROP_0,
static gboolean
initial_timeout (gpointer data)
{
- GtkRange *range;
+ GtkRange *range;
+ GtkSettings *settings;
+ guint timeout;
GDK_THREADS_ENTER ();
+ settings = gtk_widget_get_settings (GTK_WIDGET (data));
+ g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
+
range = GTK_RANGE (data);
- range->timer->timeout_id =
- g_timeout_add (SCROLL_LATER_DELAY,
- second_timeout,
- range);
+ range->timer->timeout_id = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
+ second_timeout,
+ range);
GDK_THREADS_LEAVE ();
/* remove self */
gtk_range_add_step_timer (GtkRange *range,
GtkScrollType step)
{
+ GtkSettings *settings;
+ guint timeout;
+
g_return_if_fail (range->timer == NULL);
g_return_if_fail (step != GTK_SCROLL_NONE);
-
+
+ settings = gtk_widget_get_settings (GTK_WIDGET (range));
+ g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
+
range->timer = g_new (GtkRangeStepTimer, 1);
- range->timer->timeout_id =
- g_timeout_add (SCROLL_INITIAL_DELAY,
- initial_timeout,
- range);
+ range->timer->timeout_id = g_timeout_add (timeout,
+ initial_timeout,
+ range);
range->timer->step = step;
gtk_range_scroll (range, range->timer->step);
#include "x11/gdkx.h"
#endif
+#define DEFAULT_TIMEOUT_INITIAL 200
+#define DEFAULT_TIMEOUT_REPEAT 20
+
typedef struct _GtkSettingsValuePrivate GtkSettingsValuePrivate;
typedef enum
#endif
PROP_ALTERNATIVE_BUTTON_ORDER,
PROP_SHOW_INPUT_METHOD_MENU,
- PROP_SHOW_UNICODE_MENU
+ PROP_SHOW_UNICODE_MENU,
+ PROP_TIMEOUT_INITIAL,
+ PROP_TIMEOUT_REPEAT
};
NULL);
g_assert (result == PROP_SHOW_UNICODE_MENU);
+ result = settings_install_property_parser (class,
+ g_param_spec_int ("gtk-timeout-initial",
+ P_("Start timeout"),
+ P_("Starting value for timeouts, when button is pressed"),
+ 0, G_MAXINT, DEFAULT_TIMEOUT_INITIAL,
+ G_PARAM_READWRITE),
+ NULL);
+
+ g_assert (result == PROP_TIMEOUT_INITIAL);
+
+ result = settings_install_property_parser (class,
+ g_param_spec_int ("gtk-timeout-repeat",
+ P_("Repeat timeout"),
+ P_("Repeat value for timeouts, when button is pressed"),
+ 0, G_MAXINT, DEFAULT_TIMEOUT_REPEAT,
+ G_PARAM_READWRITE),
+ NULL);
+
+ g_assert (result == PROP_TIMEOUT_REPEAT);
}
static void
#include "gtkintl.h"
#include "gtkalias.h"
-#define MIN_SPIN_BUTTON_WIDTH 30
-#define SPIN_BUTTON_INITIAL_TIMER_DELAY 200
-#define SPIN_BUTTON_TIMER_DELAY 20
-#define MAX_TIMER_CALLS 5
-#define EPSILON 1e-10
-#define MAX_DIGITS 20
-#define MIN_ARROW_WIDTH 6
+#define MIN_SPIN_BUTTON_WIDTH 30
+#define MAX_TIMER_CALLS 5
+#define EPSILON 1e-10
+#define MAX_DIGITS 20
+#define MIN_ARROW_WIDTH 6
enum {
PROP_0,
if (!spin->timer)
{
+ GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (spin));
+ guint timeout;
+
+ g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
+
spin->timer_step = step;
spin->need_timer = TRUE;
- spin->timer = g_timeout_add (SPIN_BUTTON_INITIAL_TIMER_DELAY,
- (GSourceFunc) gtk_spin_button_timer,
+ spin->timer = g_timeout_add (timeout,
+ (GSourceFunc) gtk_spin_button_timer,
(gpointer) spin);
}
gtk_spin_button_real_spin (spin, click_child == GTK_ARROW_UP ? step : -step);
if (spin_button->need_timer)
{
+ GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (spin_button));
+ guint timeout;
+
+ g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
+
spin_button->need_timer = FALSE;
- spin_button->timer = g_timeout_add (SPIN_BUTTON_TIMER_DELAY,
+ spin_button->timer = g_timeout_add (timeout,
(GSourceFunc) gtk_spin_button_timer,
(gpointer) spin_button);
}